package com.hhb.mapper;

import com.hhb.model.User;
import org.apache.ibatis.annotations.MapKey;
import org.apache.ibatis.annotations.Param;

import java.util.List;
import java.util.Map;

public interface UserMapper {

    public User findUserById(int id);
    public void add(User user);
    public void update(User user);
    public void deleteUserById(int id);

    /**
     * 如果传入的参数是模型里的字段 推荐直接传入模型
     * @param id
     * @param username
     * @return
     */
    public User findUserByIdAndUsername(@Param("id") int id, @Param("username") String username);
    public User findUserByMap(Map<String,Object> map);
    public User findUserByModel(User user);

    public List<User> findUserLikeUsername(String username);

    public Map<String,Object> findUserReturnMap(int id);

    /**
     * @MapKey("id ") 告诉mybatis 主键使用id
     * @param username
     * @return
     */
    @MapKey("username")
    public Map<String,User> findUsersReturnMapByUsername(String username);

    public User findUserAndDept(int id);

    public User findUser(int id);


}
